﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>无标题页</title>
    <script type="text/javascript">
    function loadInnerScripts()
    {
       var scbase='<span></span>';
       //scbase+='<script type="text/javascript">alert("base");function showImpact(){alert("cctv");} <\/script>';
       scbase+='<div style="width:400px; height:200px;" onclick="showImpact()">测试测试用的</div>';
       var ele=document.getElementById('innersc');  
       ele.innerHTML=scbase;
       if(document.all)
       {
         ele.innerHTML+='<script type="text/javascript" defer="defer">alert("base");function showImpact(){alert("cctv");} <\/script><div></div>';
       }else
       {
       var scripts=document.createElement("script");
       scripts.setAttribute('type','text/javascript');
       scripts.innerHTML='alert("base");function showImpact(){alert("cctv");}';
       document.getElementById('innersc').appendChild(scripts);
       }
      
    }
    function showInnerScripts()
    {
        var ele=document.getElementById('innersc');
        alert(ele.innerHTML);
    }
    </script>
</head>
<body>
<button onclick="loadInnerScripts()">Test InnerScripts</button> <button onclick="showInnerScripts()">Show InnerScripts</button>
<div id="innersc" style="background-color:Aqua; width:600px; height:400px; border:2px #b5b5b5 solid">
   
   
</div>

</body>
</html>
